package com.keller.dao;

import com.keller.domian.Product;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface ProductDao {
    //查询所有商品
    @Select("select * from product")
    public List<Product> findAll() throws Exception;

    //增加商品
    @Insert("insert into product (productNum,productName,cityName,departureTime,productPrice,productDesc,productStatus)\n" +
            "values(#{productNum},#{productName},#{cityName},#{departureTime},#{productPrice},#{productDesc},#{productStatus})")
    public void saveProduct(Product product);

    @Select("select * from product where id = #{id}")
    public Product findProductById(String id);
}
